/*
 *  ScrollBar.h
 *  Fridge
 *
 *  Created by Jeremy Abel on 7/3/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#pragma once

#include "Widget.h"
#include "Button.h"

class ScrollBar : public Widget
{
	public:
		
		ScrollBar( Widget* pxParent );
		virtual ~ScrollBar();
		
		virtual void Render( );
		virtual void Update( );
		
		virtual bool CanHaveChildren( ) { return true; };
	
		virtual void SetParentContentSize( u_int uParentContentSize ) { m_uParentContentSize = uParentContentSize; };
		virtual void SetParentVisibleSize( int iParentVisableSize ) { m_iParentVisableSize = iParentVisableSize; };
	
		virtual void SetHorizontal( const bool bHorizontal );
		virtual void SetUsingBothBars( const bool bUsingBothBars ) { m_bUsingBothBars = bUsingBothBars; };
		virtual void SetEnabled( const bool bEnabled) { m_bEnabled = bEnabled; };
	
		virtual void SetScrollbarOffset( const int iScrollbarOffset );
		virtual int  GetScrollbarOffset() { return m_iScrollbarOffset; };
		
		virtual bool GetMouseDownState() { return m_bMouseDownState; };
		
		static const u_int uSCROLLBAR_WIDTH	= 12;
	
	protected:
		
		int		m_iScrollbarOffset;
		int		m_iMinTrackPos;
		int		m_iMaxTrackPos;
		int		m_iMouseStartOffset;
		int		m_iParentVisableSize;
		int		m_iScrollDragStartOffset;
		u_int	m_uScrollHandleLength;
		u_int	m_uParentContentSize;
		bool	m_bEnabled;
		bool	m_bHorizontal;
		bool	m_bUsingBothBars;
		bool	m_bMouseDownState;
	
		Button* m_pxScrollbarButton;
};

//eof
